<%@ language="vbscript"%>
 <%
	Session("FormName")="F24"
%>
<!--#include file="..\..\CheckSession.inc"-->
<!--#include file="..\..\jvGrid.inc"-->
<%
	if Session("ClsFun").LayGiaTriQuyen(Session("Permision"),Session("FormName"),1)="1" or Session("IsAdmin") then
		sSQL="SELECT DISTINCT VTdi.ID,VTdi.soghinhan,vtdi.trichyeu,vtdi.ngayky,vtdi.nguoiky,vanban_vuviec.Loaivanban "
		sSQL=sSQL+" FROM vanban_vuviec INNER JOIN VTdi ON vanban_vuviec.mavanban = VTdi.ID INNER JOIN Vuviec ON vanban_vuviec.mavuviec = Vuviec.Ma "
		sSQL=sSQL+" WHERE (((Vuviec.Ma) Like '"& Session("bMaVV") &"') AND ((vanban_vuviec.Loaivanban) Like '2') AND ((VTdi.Trangthaiduyet)=1)) "

		sSQL1="SELECT DISTINCT VTQuyetdinh.ID,VTQuyetdinh.soghinhan,VTQuyetdinh.trichyeu,VTQuyetdinh.ngayky,VTQuyetdinh.nguoiky,vanban_vuviec.Loaivanban "
		sSQL1=sSQL1+" FROM vanban_vuviec INNER JOIN VTQuyetdinh ON vanban_vuviec.mavanban = VTQuyetdinh.ID INNER JOIN Vuviec ON vanban_vuviec.mavuviec = Vuviec.Ma "
		sSQL1=sSQL1+" WHERE (((Vuviec.Ma) Like '"& Session("bMaVV") &"') AND ((vanban_vuviec.Loaivanban) Like '5') AND ((VTQuyetdinh.Trangthaiduyet)=1)) Order by ngayky DESC"		
		
		sSQL1=sSQL & " union all " & sSQL1
	else
		sSQL="SELECT VTdi.ID,VTdi.soghinhan,vtdi.trichyeu,vtdi.ngayky,vtdi.nguoiky,vanban_vuviec.Loaivanban"
		sSQL=sSQL+" FROM Quyen INNER JOIN ((vanban_vuviec INNER JOIN VTdi ON vanban_vuviec.mavanban = VTdi.ID) INNER JOIN Vuviec ON vanban_vuviec.mavuviec = Vuviec.Ma) ON Quyen.Mavanthu = VTdi.ID"
		sSQL=sSQL+" WHERE (((Vuviec.Ma) Like '"& Session("bMaVV") &"') AND ((Quyen.Macanbo) Like '"& Session("bMaCB") &"') AND ((vanban_vuviec.Loaivanban) Like '2') AND ((Quyen.Quyen)<>'') AND ((VTdi.Trangthaiduyet)=1)) "

		sSQL1="SELECT VTQuyetdinh.ID,VTQuyetdinh.soghinhan,VTQuyetdinh.trichyeu,VTQuyetdinh.ngayky,VTQuyetdinh.nguoiky,vanban_vuviec.Loaivanban "
		sSQL1=sSQL1+" FROM Quyen INNER JOIN ((vanban_vuviec INNER JOIN VTQuyetdinh ON vanban_vuviec.mavanban = VTQuyetdinh.ID) INNER JOIN Vuviec ON vanban_vuviec.mavuviec = Vuviec.Ma) ON Quyen.Mavanthu = VTQuyetdinh.ID"
		sSQL1=sSQL1+" WHERE (((Vuviec.Ma) Like '"& Session("bMaVV") &"') AND ((Quyen.Macanbo) Like '"& Session("bMaCB") &"') AND ((vanban_vuviec.Loaivanban) Like '5') AND ((Quyen.Quyen)<>'') AND ((VTQuyetdinh.Trangthaiduyet)=1)) Order by ngayky DESC"	
		sSQL1=sSQL & " union all " & sSQL1
	end if
	'response.write(sSQL1)
	Set Rec1=Server.CreateObject("ADODB.Recordset")
	Rec1.CursorType=3
	Rec1.CacheSize=5
	rec1.Open ssql1,Conn
%>
<script language=VBScript runat=server>
	' H&#224;m &#273;&#7883;nh d&#7841;ng l&#7841;i ng&#224;y M/D/Y-> D/M/Y
	Function FormatDate(vDate)
	   If Not IsNull(vDate) Then
	        vM = Right("0" & Month(vDate), 2)
	        vD = Right("0" & Day(vDate), 2)
	        vY = Right("19" & Year(vDate), 4)
	        FormatDate = vD & "/" & vM & "/" & vY
	   End If
	End Function
	Function ModiString(mess_s)
		message = Replace("" & mess_s,"'", "''")
		ModiString=message
	End function
</script>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Gi</title>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function Row_Dblclick(bTentep) {
	window.frm.target="new";
	window.frm.action="../Xemnoidung.asp?vuviec_vanthu=di&tentep="+bTentep;
	window.frm.submit();
}

//-->
</SCRIPT>
</head>
<body topmargin="0" leftmargin="0">
<form method="POST" name=frm>
<table  border="0" width="100%" style="border-style: solid">
  <tr>
    <td width="100%" colspan="4" bgcolor="#173584" ALIGN="CENTER"><FONT COLOR="#FFFFFF" FACE="Times new roman" SIZE="3">Công
      v&#259;n &#273;i</font></td>     		
  </tr> 
  <tr bgcolor="#bdd5d0">
    <td width="15%" align="center"><font face="Arial" size="2">Mã</font></td>
    <td width="45%" align="center"><font face="Arial" size="2">Tên</font></td>
    <td width="15%" align="center"><font face="Arial" size="2">Ng&#224;y k&#253;</font></td>
    <td width="25%" align="center"><font face="Arial" size="2">Ng&#432;&#7901;i k&#253;</font></td>
  </tr>
		<input type="hidden" name=TotalMax value="<%=TotalN%>">
	<%
		STT=1
		cnt=1
			Do while not rec1.eof
				if (cnt/2=int(cnt/2)) then
					color="#eeeecc"
				else
					color="#F8F9D9"
				end if
	%>
				<tr id=mnu_<%=STT%> style="BORDER-RIGHT: #e7e7e7 1px solid; BORDER-TOP: #e7e7e7 1px solid; BORDER-LEFT: #e7e7e7 1px solid; COLOR: #666666; BORDER-BOTTOM: #e7e7e7 1px solid; HEIGHT: 21px; BACKGROUND-COLOR: <%=color%>" 
					 onmouseover="javascript:MouseOverMenu('mnu_<%=STT%>')" onmouseout="javascript:MouseOutMenu('mnu_<%=STT%>','<%=color%>')">
				  <input type="hidden" name=Ma<%=STT%> value=<%=Rec1("ID")%>>         
	<!-- 		  <input type="hidden" name=Ma<%=STT%> value=<%=Rec1("ID")%>>   -->
				  <td width="15%"><font face="Arial" size="2"><a style="cursor:hand;color:blue;text-decoration: none"
				<%if Rec1("Loai")=5 then
						bVV="qd"
					else
						bVV="di"
					end if %> 				href="../Xemnoidung.asp?LoaiVT=<%=Rec1("Loaivanban")%>&bMa=<%=Rec1("ID")%>&bNam=<%=year(Rec1("ngayky"))%>" target="_blank"><%=Rec1("soghinhan")%></a></font></td>
				  <td width="45%"><font face="Arial" size="2"><a style="cursor:hand;color:blue;text-decoration: none" href="../Xemnoidung.asp?LoaiVT=<%=Rec1("Loaivanban")%>&bMa=<%=Rec1("ID")%>&bNam=<%=year(Rec1("ngayky"))%>" target="_blank"><%=Rec1("trichyeu")%></a></font></td>
				  <td width="15%"><font face="Arial" size="2"><a style="cursor:hand;color:blue;text-decoration: none" href="../Xemnoidung.asp?LoaiVT=<%=Rec1("Loaivanban")%>&bMa=<%=Rec1("ID")%>&bNam=<%=year(Rec1("ngayky"))%>" target="_blank"><%=FormatDate(Rec1("ngayky"))%></a></font></td>
				  <td width="25%"><font face="Arial" size="2"><a style="cursor:hand;color:blue;text-decoration: none" href="../Xemnoidung.asp?LoaiVT=<%=Rec1("Loaivanban")%>&bMa=<%=Rec1("ID")%>&bNam=<%=year(Rec1("ngayky"))%>" target="_blank"><%=Rec1("nguoiky")%></a></font></td>
				</tr>
 			<%
				if  Session("VanBan")="" then
					Session("VanBan")="-"& Rec1("ID") 
				else
					Session("VanBan")=Session("VanBan") & "-" & Rec1("ID") 
				end if
			%>
			<%
					cnt=cnt+1
					STT=STT+1
					Rec1.movenext
			Loop
	Session("VanBan")=Session("VanBan") & "-"
	rec1.Close
	set rec1=nothing
%>  			
</table>
</form>
<% ' response.write (session("vanban"))%>
</body>
</html>
<%
	Conn.Close
	Set Conn=nothing
%>